<!-- application/layouts/scripts/layout.phtml -->
<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Real Theaters</title>
        <script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/jquery.min.js"></script>
        <script type="text/javascript" src="<?php echo $this->baseUrl; ?>/js/picnet.table.filter.min.js"></script>
        <script type="text/javascript" src="<?php echo $this->baseUrl; ?>/jqueryui/jqueryui.js"></script>
        <script type="text/javascript">        
            // Search
            $(function() { 
                
                $('#searchLink').click(function(){
                    $("#search").toggle();
                   
                });
                $('.close').click(function(){
                    $("#search").hide();
                   
                });
                
                $("#searchInput").keyup(function() {
                    if($(this).val().length > 0) {
                        //$("#loading").html("<img src='<?php echo $this->baseUrl; ?>/img/loading.gif' />");
                        var url = "<?php echo $this->baseUrl; ?>/movie/search/text/" + $(this).val();
                        $.ajax({
                            url: url,
                            context: document.body
                        }).done(function(text) { 
                            $("#movieSearch").html(text);
                            // $("#loading").html("");
                        });
                    }
                });
                
                $("#searchInput").keyup(function() { 
                    if($(this).val().length > 0) {
                        var url = "<?php echo $this->baseUrl; ?>/actor/search/text/" + $(this).val();
                        $.ajax({
                            url: url,
                            context: document.body
                        }).done(function(text) { 
                            $("#actorSearch").html(text);
                       
                        });
                    }
                });
                
            });
            
            
        </script>
        <link href='http://fonts.googleapis.com/css?family=Rokkitt:400,700' rel='stylesheet' type='text/css'>
            <?php echo $this->headLink()->appendStylesheet($this->baseUrl . '/css/global.css') ?>
            <?php echo $this->headLink()->appendStylesheet($this->baseUrl . '/jqueryui/jqueryui.css') ?>
    </head>
    <body>
        <div id="header">
            <div id="logo">Real theaters</div>
            <div id="links">
                <a href="<?php echo $this->baseUrl; ?>/">Home</a>
                <a href="<?php echo $this->baseUrl; ?>/Showtimes/">Show Times</a>
                <a href="<?php echo $this->baseUrl; ?>/Index/Aboutus">About us</a>
                <a style="cursor: pointer;" id="searchLink">Search</a>
                <?php
                $customerSession = new Zend_Session_Namespace('log');
                if (isset($customerSession->Customer_ID)) {
                    $customerDB = new Application_Model_Customer;
                    ?>
                    <?php if ($customerSession->Customer_ID == 1) {
                        ?>
                        <a href="<?php echo $this->baseUrl; ?>/Administration">
                            Administration
                        </a>      
                    <?php } ?>
                    <a href="<?php echo $this->url(array("controller" => "customer", "action" => "logout")); ?>">
                        <b> Log out (<?php echo $customerDB->getName($customerSession->Customer_ID); ?>)</b>
                    </a>   


                <?php } else { ?>
                    <a href="<?php echo $this->url(array("controller" => "customer", "action" => "index")); ?>">Sign In/Register</a>   
                <?php } ?>
            </div>
        </div>



        <div id="search">
            <div class="block_search">
                <h1>Search</h1>
                <input type="text" id="searchInput" />
                <span id="loading"></span>

            </div>
            <div class="block_search" id="movieSearch">
                <h1>Movies</h1>
            </div>
            <div class="block_search" id="actorSearch">
                <h1>Actors</h1>       
            </div>
            <div class="close">
                <a id="close_search" style="color: red;">X Close</a>
            </div>
        </div>





        <div id="content">

            <?php echo $this->layout()->content ?>

        </div>
        <div id="footer">
            <div id="footer_col">
                <div class="footer_col">
                    <h1>Real Theaters</h1>
                    <ul>
                        <li><a href="<?php echo $this->baseUrl; ?>/">Home</a></li>
                        <li><a href="<?php echo $this->baseUrl; ?>/Showtimes/">Show Times</a></li>
                        <li><a href="<?php echo $this->baseUrl; ?>/Index/Aboutus">About us</a></li>
                    </ul>
                </div>
                <div class="footer_col">
                    <h1>Us</h1>
                    <ul>
                        <li>Scott McKay</li>
                        <li>Luc Momal</li>
                    </ul>
                </div>
            </div>
        </div>
    </body>
</html>
